package com.ohs.ohsoa.utils;

import java.util.List;

/**
 * 工具类 基本的判空等通用工具方法
 */
public class IsNull {
    public static boolean isNotNull(String sstring) {
//        boolean bolret = true;
//        if (isNull(sstring))
////            bolret = false;
//        return bolret;
        return !isNull(sstring);
    }

    public static boolean isNotNull(int iint) {
        boolean bolret = true;
        String str = iint + "";
        if (str.equals("") || str.equals("null")) {
            bolret = false;
        }
        return bolret;
    }

    public static boolean isNotNull(Integer iint) {
        boolean bolret ;
//        if (iint == null)
//            bolret = false;
        bolret = iint != null ;
        return bolret;
    }

    public static boolean isNotNull(Long iint) {
        boolean bolret = true;
        if (iint == null) {
            bolret = false;
        } else if (iint.intValue() == 0) {
            bolret = false;
        } else if (isNull(iint + "")) {
            bolret = false;
        }
        return bolret;
    }

    public static boolean isNull(Integer iint) {
//        boolean ret = false;
//        if (iint == null) {
//            ret = true;
//        }
//
//        return ret;
        return iint == null;
    }

    public static boolean isNull(Object obj) {
        boolean ret = false;
        if (obj == null || obj == "" || obj == "null") {
            ret = true;
        }

        return ret;
    }

    public static boolean isNull(String sstring) {
        boolean bolret = false;
        if ((sstring == null) || (sstring.trim().equals("null")) || (sstring.trim().equals("")))
            bolret = true;
        return bolret;
    }

    public static boolean isNull(List<?> lst) {
        boolean bolret = false;
//        if (lst == null)
//            bolret = true;
        bolret = lst == null;
        if ((lst != null) && (lst.size() == 0))
            bolret = true;
        return bolret;
    }

    public static String isStrNotNull(String str) {
        if ((str == null) || ("null".equals(str)) || ("".equals(str.trim())))
            return "";
        return str.trim();
    }




}
